package com.koocloud.electroplatemanage.controller;

import com.koocloud.electroplatemanage.common.pojo.ResponseTemplate;
import com.koocloud.electroplatemanage.pojo.AnalysisItems;
import com.koocloud.electroplatemanage.pojo.OriginItems;
import com.koocloud.electroplatemanage.service.OriginItemsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program:
 * @description:
 * @author: wjx
 * @create: 2020/11/17 16:32
 */
@RestController
@RequestMapping("/originItems")
public class OriginItemsController {

    @Autowired
    private OriginItemsService originItemsService;

    /**
     * @Description:通过pk查询镀槽分析单一条记录
     * @Param: [pk]
     * @return: com.koocloud.electroplatemanage.common.ResponseTemplate
     * @Author: wjx
     * @date: 2020/11/17
     */
    @RequestMapping(value = "/selectByPk",method = RequestMethod.POST,name = "主键查询")
    public ResponseTemplate selectByPk(@RequestParam(name = "analysisItemsId") String pk){
        return originItemsService.selectByPk(pk);
    }

    /**
     * @Description:通过镀槽的编号查询镀槽分析单一条记录
     * @Param: [pk]
     * @return: com.koocloud.electroplatemanage.common.ResponseTemplate
     * @Author: wjx
     * @date: 2020/11/17
     */
    @RequestMapping(value = "/selectByTankNo",method = RequestMethod.POST,name = "通过镀槽查询")
    public ResponseTemplate selectByTankNo(@RequestParam(name = "tankNo") String tankNo){
        return originItemsService.selectByTankNo(tankNo);
    }

    /**
     * @Description:插入一组数据
     * @Param: [pk]
     * @return: com.koocloud.electroplatemanage.common.ResponseTemplate
     * @Author: wjx
     * @date: 2020/11/17
     */
    @RequestMapping(value = "/batchInsert",method = RequestMethod.POST,name = "批量插入数据")
    public ResponseTemplate batchInsert(@RequestParam(name = "tankNo") String tankNo,@RequestBody List<OriginItems> originItemsList){
        return originItemsService.batchInsert(tankNo,originItemsList);
    }
}
